﻿using System;
using System.Drawing.Imaging;
using System.Xml.Serialization;

using QuickShot.Shortcut;

namespace QuickShot.Preferences
{
    public sealed class UserPreferences : IEquatable<UserPreferences>
    {

        
        public Hotkey FullscreenHotkey { get; set; }
        public Hotkey RegionHotkey { get; set; }
        public Hotkey ActiveWindowHotkey { get; set; }

        public bool CapturePrimaryDisplay { get; set; }
        public bool SaveAfterCapture { get; set; }
        public bool AutomaticNaming { get; set; }
        public string SaveDirectory { get; set; }
        public ImageFormat Format { get; set; }

        public UserPreferences() 
        {

        }

        public override bool Equals(object obj)
        {
            return (Equals(obj as UserPreferences));
        }

        public bool Equals(UserPreferences other)
        {
            return other.FullscreenHotkey == FullscreenHotkey
                && other.RegionHotkey == RegionHotkey
                && other.ActiveWindowHotkey == ActiveWindowHotkey
                && other.CapturePrimaryDisplay == CapturePrimaryDisplay
                && other.SaveAfterCapture == SaveAfterCapture
                && other.AutomaticNaming == AutomaticNaming
                && other.SaveDirectory == SaveDirectory
                && other.Format == Format;
        }

        public static bool operator ==(UserPreferences a, UserPreferences b)
        {
            if (ReferenceEquals(a, b))
                return true;

            if ((a as object == null) || (b as object == null))
                return false;

            return Equals(a, b);
        }

        public static bool operator !=(UserPreferences a, UserPreferences b)
        {
            return !(a == b);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
